<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const canvas = document.createElement("canvas");
        canvas.width = 600;
        canvas.height = 600;
        document.body.appendChild(canvas);
        let context =  canvas.getContext("2d");
        // 设置阴影
        context.shadowOffsetX = 50;
        context.shadowOffsetY = 50;
        context.shadowBlur = 2;
        context.shadowColor = "rgba(0, 0, 0, 0.5)";
        // 绘制红色矩形
        context.fillStyle = "#ff0000";
        context.fillRect(10, 10, 50, 50);
        // 绘制蓝色矩形 26 context.fillStyle = "rgba(0,0,255,1)";
        context.fillRect(30, 30, 50, 50);
    </script>
  </body>
</html>
